<?php
//=======================================
//###################################
// Kayako Web Solutions
//
// Source Copyright 2001-2004 Kayako Infotech Ltd.
// Unauthorized reproduction is not allowed
// License Number: $%LICENSE%$
// $Author: vshoor $ ($Date: 2006/01/25 15:39:50 $)
// $RCSfile: index.php,v $ : $Revision: 1.4 $ 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//###################################
//=======================================


define("SWIFT_AREA", 80);


if (defined("SWIFTCUSTOMPATH"))
{
	chdir(SWIFTCUSTOMPATH);
} else {
	chdir('./../');
}
require_once ("./swift.php");

// Lets see if theres an entry for ban
$cookie->parseCookie("visitor");
$bancookie = $cookie->getKey("visitor", "isbanned");

if ($bancookie == "")
{
	// it seems like we never did check this visitor to see if hes banned check now
	$banresult = $dbCore->queryFetch("SELECT `visitorbanid` FROM `". TABLE_PREFIX ."visitorbans` WHERE `ipaddress` = '". $dbCore->escape($_SWIFT["IP"]) ."' LIMIT 1;");
	if (trim($banresult["visitorbanid"]) != "")
	{
		// He is banned!
		$cookie->addCookie("visitor", "isbanned", "1");
		$isbanned = true;
	} else {
		$cookie->addCookie("visitor", "isbanned", "0");
		$isbanned = false;
	}
	$cookie->buildCookie("visitor");
} else if ($bancookie == "1") {
	$isbanned = true;
} else {
	$isbanned = false;
}

if ($isbanned == false)
{
	if (!$events->triggerEvent(EVENT_VISITOR)) {
		// Display default frontpage here
	}	
}
?>